win32: fix gdk_win32_window_raise
authorDieter Verfaillie <dieterv@optionexplicit.be>
Wed, 25 Jan 2012 12:02:21 +0000 (13:02 +0100)
committerDieter Verfaillie <dieterv@optionexplicit.be>
Wed, 25 Jan 2012 19:32:50 +0000 (20:32 +0100)
commitfe1907708c4edb5a97184a2e027b7a028a7b5554
tree3209134e200b19308082f8a3f062891e41bd21ce
parent8da4c2affabd02628f5151abd166f72dfbaa88b1
win32: fix gdk_win32_window_raise

When calling gtk_window_present(), gdk_win32_window_raise did not
actually raise the window anymore. Replacing BringWindowToTop() with
SetForegroundWindow() fixes this.

During testing, we also discovered that sometimes SetForeGroundWindow()
will (correctly) refuse to raise the window and fail(for example: sometimes
when dragging a different application at the time of a gtk_window_present()
call). To prevent a GdkWarning from being produced, usage of the API_CALL
macro has been removed for this case.

Additional goodies of SetForeGroundWindow:
- it brings the window to the front when the process owning the
  window to raise is the foreground process (for example when
  gtk_window_present is called from a GtkStatusIcon's activate
  signal handler)
- it limits itself to flashing the task bar button associated
  with the window if the process owning the window to raise
  is *not* the foreground process (for example when gtk_window_present
  is called from a g_timeout_add callback function)

https://bugzilla.gnome.org/show_bug.cgi?id=665760
gdk/win32/gdkwindow-win32.c